package com.testing.class15;

import com.testing.inter.InterKeyWord;

/**
 * @Classname RestKwTest
 * @Description 类型说明
 * @Date 2022/11/7 21:13
 * @Created by 特斯汀Roy
 */
public class RestKwTest {

    public static void main(String[] args) {
        InterKeyWord inter=new InterKeyWord();
        inter.saveParam("url","http://www.testingedu.com.cn:8081/inter/REST");
        //auth接口调用
        inter.testPostUrl("{url}/auth","");
        inter.saveJsonParam("tokenValue","$.token");

        inter.addHeader("{\"token\":\"{tokenValue}\"}");

        inter.saveDateParam("用户名","roy","mmss");

        //注册请求
        inter.testPostUrl("{url}/user/register","{\"username\":\"{用户名}\",\"pwd\":\"123456\",\"nickname\":\"12123412\",\"describe\":\"12341234\"}");
        inter.assertJsonContainsValue("$.msg","注册成功");

        //登录
        inter.testPostUrl("{url}/login/{用户名}/123456","");
        inter.assertJsonContainsValue("$.msg","成功");
        inter.saveJsonParam("id","$.userid");

        //用户信息
        inter.testPostUrl("{url}/login/{id}","");
        inter.assertJsonContainsValue("$.msg","查询成功");
        inter.assertJsonValue("$.nickname","{id}");

        //注销
        inter.testPostUrl("{url}/login","");
        inter.assertJsonContainsValue("$.msg","注销成功");





    }

}
